import request from '@/utils/request';

export async function getChartsData() {
  return request('/api/newhope/data/echartsData', {
    method: 'POST',
    data: {},
  });
}

// 数据查询
export async function getDataQueryList(params) {
  return request('/api/newhope/data/list', {
    params,
  });
}

export async function exportDataQuery(data) {
  return request('/api/newhope/data/export', {
    method: 'POST',
    data,
  });
}

// 上传
export async function uploadData(data) {
  return request('/api/newhope/transfer/uploadData', {
    method: 'POST',
    data,
  });
}

// 所有检测点
export async function getCheckPointAll() {
  return request('/api/newhope/device/getAll');
}

// 近红外配置
export async function getDataConfigList(params) {
  return request('/api/newhope/device/list', {
    params,
  });
}

export async function addDataConfig(data) {
  return request('/api/newhope/device/add', {
    method: 'POST',
    data,
  });
}

export async function removeDataConfig(params) {
  return request('/api/newhope/device/remove', {
    params,
  });
}

export async function updateDataConfig(data) {
  return request('/api/newhope/device/edit', {
    method: 'POST',
    data,
  });
}

// 物料主数据设置
export async function getMaterialMainDataListAll() {
  return request('/api/newhope/material/all');
}

export async function exportMaterialMainData(data) {
  return request('/api/newhope/material/export', {
    method: 'POST',
    data,
  });
}

export async function getMaterialMainDataList(params) {
  return request('/api/newhope/material/list', {
    params,
  });
}

export async function addMaterialMainData(data) {
  return request('/api/newhope/material/add', {
    method: 'POST',
    data,
  });
}

export async function removeMaterialMainData(params) {
  return request('/api/newhope/material/remove', {
    params,
  });
}

export async function updateMaterialMainData(data) {
  return request('/api/newhope/material/edit', {
    method: 'POST',
    data,
  });
}

// 物料检测项目设置
export async function getMaterialCheckProjectList(params) {
  return request('/api/newhope/materialInspection/list', {
    params,
  });
}

export async function exportMaterialCheckProject(data) {
  return request('/api/newhope/materialInspection/export', {
    method: 'POST',
    data,
  });
}

export async function addMaterialCheckProject(data) {
  return request('/api/newhope/materialInspection/add', {
    method: 'POST',
    data,
  });
}

export async function removeMaterialCheckProject(params) {
  return request('/api/newhope/materialInspection/remove', {
    params,
  });
}

export async function updateMaterialCheckProject(data) {
  return request('/api/newhope/materialInspection/edit', {
    method: 'POST',
    data,
  });
}

// 化验项目设置
export async function getMaterialAssayProjectListAll() {
  return request('/api/newhope/inspection/all');
}

export async function exportInspection(data) {
  return request('/api/newhope/inspection/export', {
    method: 'POST',
    data,
  });
}

export async function getMaterialAssayProjectList(params) {
  return request('/api/newhope/inspection/list', {
    params,
  });
}

export async function addMaterialAssayProject(data) {
  return request('/api/newhope/inspection/add', {
    method: 'POST',
    data,
  });
}

export async function removeMaterialAssayProject(params) {
  return request('/api/newhope/inspection/remove', {
    params,
  });
}

export async function updateMaterialAssayProject(data) {
  return request('/api/newhope/inspection/edit', {
    method: 'POST',
    data,
  });
}

// 用户管理
export async function getUserList(params) {
  return request('/api/newhope/user/list', {
    params,
  });
}

export async function addUser(data) {
  return request('/api/newhope/user/add', {
    method: 'POST',
    data,
  });
}

export async function removeUser(params) {
  return request('/api/newhope/user/remove', {
    params,
  });
}

export async function updateUser(data) {
  return request('/api/newhope/user/edit', {
    method: 'POST',
    data,
  });
}

// 报警铃声
// 通用文件上传
export async function fileUpload(data) {
  return request('/api/common/upload', {
    method: 'POST',
    data,
  });
}

export async function getAudioList(params) {
  return request('/api/newhope/audio/list', {
    params,
  });
}
export async function getAudioAll() {
  return request('/api/newhope/audio/getAll');
}

export async function addAudio(data) {
  return request('/api/newhope/audio/add', {
    method: 'POST',
    data,
  });
}

export async function removeAudio(params) {
  return request('/api/newhope/audio/remove', {
    params,
  });
}

export async function updateAudio(data) {
  return request('/api/newhope/audio/edit', {
    method: 'POST',
    data,
  });
}

// 获取消息列表
export async function getMessageList() {
  return request('/api/newhope/warning/getAll');
}

// 获取铃声间隔刷新时间
export async function getRefreshTime(id) {
  return request(`/api/newhope/setting/edit/${id}`);
}

// 设置刷新间隔时间
export async function setRefreshTime(data) {
  return request('/api/newhope/setting/edit', {
    method: 'POST',
    data,
  });
}
// 报警历史
export async function getHistoryList(params) {
  return request('/api/newhope/warningLog/list', {
    params,
  });
}

// 获取报警铃声数据
export async function getAudioData() {
  return request('/api/newhope/warning/getOne');
}

// 导出报警历史
export async function exportWarningLog(data) {
  return request('/api/newhope/warningLog/export', {
    method: 'POST',
    data
  });
}

export async function removeMessage(params) {
  return request('/api/newhope/warning/remove', {
    method: 'get',
    params
  });
}
